<html>
<head><meta charset="utf-8"><title>proptest in ra_text_edit · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html">proptest in ra_text_edit</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="177238218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177238218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177238218">(Oct 03 2019 at 12:23)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> in <a href="https://github.com/rust-analyzer/rust-analyzer/pull/1926#issuecomment-535849720" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/1926#issuecomment-535849720">https://github.com/rust-analyzer/rust-analyzer/pull/1926#issuecomment-535849720</a> and <a href="https://github.com/rust-analyzer/rust-analyzer/issues/1925#issuecomment-535842174" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/1925#issuecomment-535842174">https://github.com/rust-analyzer/rust-analyzer/issues/1925#issuecomment-535842174</a> you mention implementing <code>Arbitrary</code> and how moving some code around isn't possible due to the coherence rules. This might change in the future (also <code>quickcheck</code>), but right now there's no <code>Arbitrary</code> instance in <code>ra_text_edit</code></p>



<a name="177238285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177238285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177238285">(Oct 03 2019 at 12:24)</a>:</h4>
<p>I checked, and moving that code around fixes <a href="https://github.com/rust-lang/rust/issues/1925" target="_blank" title="https://github.com/rust-lang/rust/issues/1925">#1925</a>, but it might go against your plans</p>



<a name="177238579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177238579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177238579">(Oct 03 2019 at 12:28)</a>:</h4>
<p>On the other hand, <code>proptest</code> itself is not the issue here. <code>ra_text_edit</code> has a dependency on <code>proptest</code>, while <code>ra_ide_api</code> has a dev-dependency on it. For some reason, if I build everything, touch the code in <code>ra_syntax</code>, build <code>ra_cli</code>, then build <code>ra_lsp_server</code>, a lot of the RA crates will get rebuilt. I imagine moving to <code>quickcheck</code> won't change that behavior.</p>



<a name="177238598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177238598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177238598">(Oct 03 2019 at 12:28)</a>:</h4>
<p>Removing <code>proptest</code> from <code>ra_text_edit</code> fixes this.</p>



<a name="177239688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177239688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177239688">(Oct 03 2019 at 12:42)</a>:</h4>
<p>Maybe <code>cargo</code> could be smarter here, but it's a bit icky that a crate should pull a heavyweight dependency just in case others want to use it for testing</p>



<a name="177321115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177321115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177321115">(Oct 04 2019 at 08:56)</a>:</h4>
<p>Ah, right, we directly provide a function that yields arbitrary text and edits.... Still, I think it makes sense to provide this function as part of <code>TextEdit</code> crate.</p>



<a name="177321147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177321147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177321147">(Oct 04 2019 at 08:57)</a>:</h4>
<p>The problem here is that <code>proptest</code> is heavy weight: really, providing a strategy for generation shouldn't require that much code to be compiled</p>



<a name="177322669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177322669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177322669">(Oct 04 2019 at 09:19)</a>:</h4>
<p>That's what I'm trying to say. Even if <code>proptest</code> took one second to build, with the current setup touching a file in <code>ra_syntax</code> makes <code>cargo</code> rebuild every RA crate twice.</p>



<a name="177322738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177322738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177322738">(Oct 04 2019 at 09:20)</a>:</h4>
<p>At least if you're building both <code>ra_cli</code> and <code>ra_lsp_server</code></p>



<a name="177322771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177322771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177322771">(Oct 04 2019 at 09:20)</a>:</h4>
<p>I'm not sure why, though, but it seems to be caused by the extra non-dev <code>proptest</code> dependency</p>



<a name="177323220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177323220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177323220">(Oct 04 2019 at 09:27)</a>:</h4>
<div class="codehilite"><pre><span></span>$ cargo build --release
   Finished release [optimized + debuginfo] target(s) in 0.06s
$ touch crates/ra_syntax/src/lib.rs
$ cargo build --release -p ra_cli
  Compiling proptest v0.9.4
  Compiling ra_text_edit v0.1.0 (~/rust-analyzer/crates/ra_text_edit)
  Compiling ra_syntax v0.1.0 (~/rust-analyzer/crates/ra_syntax)
  Compiling ra_db v0.1.0 (~/rust-analyzer/crates/ra_db)
  Compiling ra_mbe v0.1.0 (~/rust-analyzer/crates/ra_mbe)
  Compiling ra_fmt v0.1.0 (~/rust-analyzer/crates/ra_fmt)
  Compiling ra_project_model v0.1.0 (~/rust-analyzer/crates/ra_project_model)
  Compiling ra_hir v0.1.0 (~/rust-analyzer/crates/ra_hir)
  Compiling ra_assists v0.1.0 (~/rust-analyzer/crates/ra_assists)
  Compiling ra_ide_api v0.1.0 (~/rust-analyzer/crates/ra_ide_api)
  Compiling ra_batch v0.1.0 (~/rust-analyzer/crates/ra_batch)
  Compiling ra_cli v0.1.0 (~/rust-analyzer/crates/ra_cli)
   Finished release [optimized + debuginfo] target(s) in 1m 52s
$ cargo build --release
  Compiling ra_syntax v0.1.0 (~/rust-analyzer/crates/ra_syntax)
  Compiling ra_db v0.1.0 (~/rust-analyzer/crates/ra_db)
  Compiling ra_mbe v0.1.0 (~/rust-analyzer/crates/ra_mbe)
  Compiling ra_fmt v0.1.0 (~/rust-analyzer/crates/ra_fmt)
  Compiling ra_project_model v0.1.0 (~/rust-analyzer/crates/ra_project_model)
  Compiling ra_hir v0.1.0 (~/rust-analyzer/crates/ra_hir)
  Compiling ra_assists v0.1.0 (~/rust-analyzer/crates/ra_assists)
  Compiling ra_ide_api v0.1.0 (~/rust-analyzer/crates/ra_ide_api)
  Compiling ra_lsp_server v0.1.0 (~/rust-analyzer/crates/ra_lsp_server)
  Compiling ra_batch v0.1.0 (~/rust-analyzer/crates/ra_batch)
  Compiling ra_cli v0.1.0 (~/rust-analyzer/crates/ra_cli)
   Finished release [optimized + debuginfo] target(s) in 14.48s
$ cargo build --release -p ra_lsp_server
   Compiling ra_syntax v0.1.0 (~/rust-analyzer/crates/ra_syntax)
   Compiling ra_db v0.1.0 (~/rust-analyzer/crates/ra_db)
   Compiling ra_mbe v0.1.0 (~/rust-analyzer/crates/ra_mbe)
   Compiling ra_fmt v0.1.0 (~/rust-analyzer/crates/ra_fmt)
   Compiling ra_project_model v0.1.0 (~/rust-analyzer/crates/ra_project_model)
   Compiling ra_hir v0.1.0 (~/rust-analyzer/crates/ra_hir)
   Compiling ra_assists v0.1.0 (~/rust-analyzer/crates/ra_assists)
   Compiling ra_ide_api v0.1.0 (~/rust-analyzer/crates/ra_ide_api)
   Compiling ra_lsp_server v0.1.0 (~/rust-analyzer/crates/ra_lsp_server)
    Finished release [optimized + debuginfo] target(s) in 8.15s
$ cargo build --release
    Finished release [optimized + debuginfo] target(s) in 0.05s
</pre></div>



<a name="177323383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proptest%20in%20ra_text_edit/near/177323383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proptest.20in.20ra_text_edit.html#177323383">(Oct 04 2019 at 09:30)</a>:</h4>
<p>Maybe it only happens with <code>-p</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>